var highlightMappings = new Object();

function addHighlightMappings(matcher, path) {
	highlightMappings[matcher] = path
}

function highlight() {
	var path = window.location.pathname	
	var element = jq("a[href='"+path+"']")
	if (element.length > 0) {
		element.parent("td").parent("tr").addClass("menuchildselected")
	} else {
		for(var highlightMapping in highlightMappings) {
			if (path.match(highlightMapping)) {
				element = jq("a[href='"+highlightMappings[highlightMapping]+"']")
				element.parent("td").parent("tr").addClass("menuchildselected")
			}
		}
	}
}

jq(function(){
	jq(".menutable .menuchild").hover(
	  function () {
	    jq(this).addClass("menuchildselected")
	    highlight()
	  }, 
	  function () {
	    jq(this).removeClass("menuchildselected")
	    highlight()
	  }
	)
	highlight()
})